package cn.credit.loan.service.loanapplication;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.credit.loan.dao.loanapplication.LoanapplicationMapper;
import cn.credit.loan.entity.Loanapplication;

@Service
public class LoanapplicationServiceImpl implements LoanapplicationService {

	//注入
	@Autowired
	private LoanapplicationMapper loanapplicationMapper;
	
	/**
	 * 查看所有的用户贷款申请列表
	 */
	@Override
	public List<Loanapplication> getLoanAppLicationList(Loanapplication loanapplication)throws Exception {
		List<Loanapplication> loanapplicationlist=loanapplicationMapper.getLoanAppLicationList(loanapplication);
		if(loanapplicationlist!=null){
			
			return loanapplicationlist;
		}
		return null;
	}
	
	/**
	 * 客户申请贷款信息
	 */
	@Override
	public Boolean addLoanApp(Loanapplication loanapplication) throws Exception {
		if(loanapplication!=null){
			if(loanapplicationMapper.addLoanapp(loanapplication)>0)
				return true; 
		}
		return false;
	}
/**
 * 用户贷款信息删除
 */
	@Override
	public boolean deleteLoanapp(int loanId) throws Exception {
		if(loanapplicationMapper.deleteLoanapp(loanId)){
			return true;
		}
		return false;
	}
	
	/**
	 * 
	 */
	@Override
	public boolean updateByLoan(String loanId, String loanType)throws Exception {	
		int num=loanapplicationMapper.updateByLoan(loanId, loanType);
		if(num>=1){
			return true;
		}
		return false;
	}
	
}
